var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (i, t) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, i) {
              e.__proto__ = i;
            }) ||
          function (e, i) {
            for (var t in i)
              Object.prototype.hasOwnProperty.call(i, t) && (e[t] = i[t]);
          })(i, t);
      };
      return function (i, t) {
        function n() {
          this.constructor = i;
        }
        if ("function" != typeof t && null !== t)
          throw new TypeError(
            "Class extends value " + String(t) + " is not a constructor or null"
          );
        e(i, t),
          (i.prototype =
            null === t
              ? Object.create(t)
              : ((n.prototype = t.prototype), new n()));
      };
    })(),
  AXSupplemnetArmyDialog = (function (e) {
    function i() {
      var i = e.call(this) || this;
      return (
        (i.onLoadArmyDiuQiDataFn = {
          caller: i,
          code: 1089,
          method: function (e) {
            0 == e.code
              ? (ToastView.toastView("丢弃成功"),
                WebSocketService.send({ c: 1423, d: { pageNum: 0 } }))
              : ToastView.toastView(e.msg);
          },
        }),
        (i.onLoadArmyDetailDataFn = {
          caller: i,
          code: 1062,
          method: function (e) {
            if (0 == e.code) {
              for (
                var t = e.data,
                  n = "",
                  o = "",
                  a = 0,
                  l = void 0,
                  s = !1,
                  r = 0;
                r < t.length;
                r++
              ) {
                var p = t[r].k,
                  u = t[r].v;
                if ("名称:" != p)
                  if ("图片:" != p)
                    if ("重量:" != p)
                      if ("等级:" != p)
                        if ("高阶属性:" != p)
                          if ("效果:" != p)
                            if ("剩余宝石孔:" != p)
                              if ("佩带条件:" != p)
                                if ("介绍:" != p) {
                                  if ("是否装备:" != p && "宝石孔:" == p) {
                                    if ("无宝石孔" == t[r].v) continue;
                                    var c = u.replace("(", "");
                                    c = c.replace(")", "");
                                    h = new Array();
                                    h = c.split(",");
                                    for (var d = 0; d < h.length; d++) {
                                      var m = h[d];
                                      0 == d
                                        ? (i.label_supplement_item1.text =
                                            i.dealBaoShiKongView(m))
                                        : 1 == d
                                        ? (i.label_supplement_item2.text =
                                            i.dealBaoShiKongView(m))
                                        : 2 == d &&
                                          (i.label_supplement_item3.text =
                                            i.dealBaoShiKongView(m));
                                    }
                                  }
                                } else n = n + p + u + "\n";
                              else n = n + p + u + "\n";
                            else n = n + p + u + "\n";
                          else {
                            var h = u.split(",");
                            n =
                              a <= 10
                                ? n + p + u + "\n"
                                : s
                                ? n + p + u + "\n\n"
                                : n + p + u + "\n";
                          }
                        else {
                          (s = !0), (o = p + u);
                          (l = u.match(/\d+/g)),
                            parseInt(l) >= 10 &&
                              ((i.label_xilian_tips.visible = !1),
                              (i.label_zhuangbei_xilian.visible = !1));
                        }
                      else
                        (a = u),
                          u >= 11
                            ? ((i.label_xilian_tips.visible = !0),
                              (i.label_zhuangbei_xilian.visible = !0))
                            : ((i.label_xilian_tips.visible = !1),
                              (i.label_zhuangbei_xilian.visible = !1));
                    else n = n + p + u + "\n";
                  else i.image_supplement_icon.skin = "arming/" + u + ".png";
                else i.lbl_suppleArmyTitle.text = u;
              }
              (i.label_zhuangbei_gaoji.text = o), (i.lbl_suppleArmyLv.text = n);
            }
          },
        }),
        (i.onLoadSuppleArmyDataFn = {
          caller: i,
          code: 1137,
          method: function (e) {
            i.close(),
              0 == e.code
                ? (ToastView.toastView("穿戴" + i.armyObj.name + "成功"),
                  WebSocketService.send({ c: 1423, d: { pageNum: 0 } }))
                : ToastView.toastView(e.msg);
          },
        }),
        WebSocketService.addListener(i.onLoadSuppleArmyDataFn),
        WebSocketService.addListener(i.onLoadArmyDiuQiDataFn),
        WebSocketService.addListener(i.onLoadArmyDetailDataFn),
        WebSocketService.addListener({
          caller: i,
          code: 1094,
          method: i.onLoadArmyXiKongFn,
        }),
        i.btn_supArmy_ChuanDai.on(Laya.Event.CLICK, i, i.onChuanDaiDidClickFn),
        i.btn_suookement_diuqi.on(
          Laya.Event.CLICK,
          i,
          i.onDidSuppleDiuQiZhuangBeiClickFn
        ),
        i.label_supplement_item1.on(
          Laya.Event.CLICK,
          i,
          i.onDidSupplementAction
        ),
        i.label_supplement_item2.on(
          Laya.Event.CLICK,
          i,
          i.onDidSupplementAction
        ),
        i.label_supplement_item3.on(
          Laya.Event.CLICK,
          i,
          i.onDidSupplementAction
        ),
        i.label_zhuangbei_xilian.on(Laya.Event.CLICK, i, i.onDidXiLianAction),
        WebSocketService.addListener({
          caller: i,
          code: 5288,
          method: i.onLoadEquipmentXiLianData,
        }),
        i
      );
    }
    return (
      __extends(i, e),
      (i.prototype.onDidXiLianAction = function () {
        this.armyObj.id &&
          "" != this.armyObj.id &&
          WebSocketService.send({ c: 5288, d: { armingId: this.armyObj.id } });
      }),
      (i.prototype.onLoadEquipmentXiLianData = function (e) {
        ToastView.toastView(e.msg),
          WebSocketService.send({ c: 1062, d: { id: this.armyObj.id } }),
          Laya.stage.event("GameMainView", "refreshMoney"),
          Laya.stage.event("HomePageView", "refreshMoney");
      }),
      (i.showSuppleArmyDialog = function (e, t) {
        null == this.suppleDialog &&
          ((this.suppleDialog = new i()), (this.suppleDialog.zOrder = 1e3)),
          this.suppleDialog.popup(),
          (this.suppleDialog.armyObj = e),
          (this.suppleDialog.label_zhuangbei_gaoji.text = ""),
          (this.suppleDialog.label_zhuangbei_xilian.visible = !1),
          (this.suppleDialog.label_xilian_tips.visible = !1),
          (this.suppleDialog.lbl_suppleArmyTitle.text = e.name),
          (this.suppleDialog.lbl_suppleArmyLv.text = "等级：" + e.level),
          WebSocketService.send({ c: 1062, d: { id: e.id } }),
          "guanyi" == t
            ? ((this.suppleDialog.btn_suookement_diuqi.visible = !1),
              (this.suppleDialog.btn_supArmy_ChuanDai.visible = !1))
            : ((this.suppleDialog.btn_suookement_diuqi.visible = !0),
              (this.suppleDialog.btn_supArmy_ChuanDai.visible = !0));
      }),
      (i.prototype.onChuanDaiDidClickFn = function () {
        WebSocketService.send({ c: 1137, d: { id: this.armyObj.id } });
      }),
      (i.prototype.onDidSuppleDiuQiZhuangBeiClickFn = function () {
        WebSocketService.send({ c: 1089, d: { id: this.armyObj.id } }),
          this.close();
      }),
      (i.prototype.dealBaoShiKongView = function (e) {
        var i = "";
        if ("空" != e)
          for (var t = e.split("+"), n = 0; n < t.length; n++) {
            var o = t[n];
            i = n == t.length - 1 ? i + "+" + o : i + o + "\n";
          }
        return i;
      }),
      (i.prototype.onDidSupplementAction = function (e) {
        "item_supply_lab1" == e.target.name
          ? this.label_supplement_item1.text.length > 0 &&
            NormalDialog.showNormalDialog(
              "您确定要洗掉" +
                this.armyObj.name +
                "的宝石孔1？\n（洗掉后宝石将消失）",
              this,
              this.onSureXiBaoShiKong1
            )
          : "item_supply_lab2" == e.target.name
          ? this.label_supplement_item2.text.length > 0 &&
            NormalDialog.showNormalDialog(
              "您确定要洗掉" +
                this.armyObj.name +
                "的宝石孔2？\n（洗掉后宝石将消失）",
              this,
              this.onSureXiBaoShiKong2
            )
          : "item_supply_lab3" == e.target.name &&
            this.label_supplement_item3.text.length > 0 &&
            NormalDialog.showNormalDialog(
              "您确定要洗掉" +
                this.armyObj.name +
                "的宝石孔3？\n（洗掉后宝石将消失）",
              this,
              this.onSureXiBaoShiKong3
            );
      }),
      (i.prototype.onSureXiBaoShiKong1 = function () {
        WebSocketService.send({ c: 1094, d: { id: this.armyObj.id, i: 1 } });
      }),
      (i.prototype.onSureXiBaoShiKong2 = function () {
        WebSocketService.send({ c: 1094, d: { id: this.armyObj.id, i: 2 } });
      }),
      (i.prototype.onSureXiBaoShiKong3 = function () {
        WebSocketService.send({ c: 1094, d: { id: this.armyObj.id, i: 3 } });
      }),
      (i.prototype.onLoadArmyXiKongFn = function (e) {
        0 == e.code &&
          (WebSocketService.send({ c: 1062, d: { id: this.armyObj.id } }),
          WebSocketService.send({ c: 1423, d: { pageNum: 0 } }));
      }),
      (i.close = function () {
        this.suppleDialog && this.suppleDialog.close();
      }),
      i
    );
  })(ui.TabBarItemController.AXSupplemnetArmyDialogUI);
